<template>
    <section>
        <!--工具条-->
        <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
            <el-form :inline="true" :model="filters">

                <el-form-item label="运营商" prop="operatoruid">
                    <el-select v-model="filters.operatoruid" filterable  collapse-tags clearable placeholder="请选择运营商">
                        <el-option value="0" label="全部">全部</el-option>
                        <el-option
                                v-for="item in operator"
                                :key="item.operatoruid"
                                :label="item.operatorname"
                                :value="item.operatoruid">
                        </el-option>
                    </el-select>
                </el-form-item>

                <el-form-item label="省份" prop="provinceuuid">
                    <el-select v-model="filters.provinceuuid" clearable filterable collapse-tags :filter-method="selectfilter" placeholder="请选择省份">
                        <el-option value="0" label="全部">全部</el-option>
                        <el-option
                                v-for="item in info"
                                :key="item.provinceuuid"
                                :label="item.provincename"
                                :value="item.provinceuuid">
                            <span style="float: left">{{ item.provincename }}</span>
                            <span style="float: right; color: #8492a6; font-size: 13px">{{ item.label }}</span>
                        </el-option>
                    </el-select>
                </el-form-item>

                <el-form-item label="城市">
                    <el-select v-model="filters.cityName" filterable clearable collapse-tags placeholder="请选择地市">
                        <el-option
                                v-for="item in infoFilters"
                                :key="item.cityName"
                                :label="item.cityName"
                                :value="item.cityName">
                        </el-option>
                    </el-select>
                </el-form-item>

                <el-form-item label="业务类型" prop="busuuid">
                    <el-select v-model="filters.busuuid" filterable clearable collapse-tags placeholder="请选择业务类型">
                        <el-option value="0" label="全部">全部</el-option>
                        <el-option
                                v-for="item in bus"
                                :key="item.busuuid"
                                :label="item.busname"
                                :value="item.busuuid">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="分销商" prop="useruuid">
                    <el-select v-model="filters.useruuid" clearable placeholder="请选择分销商" collapse-tags filterable multiple v-show="isShow"
                               @change="userChange">
                        <el-option value="0" label="全部">全部</el-option>
                        <el-option
                                v-for="item in users"
                                :key="item.user.useruuid"
                                :label="item.user.username"
                                :value="item.user.useruuid">
                        </el-option>
                    </el-select>
                </el-form-item>


                <el-form-item label="匹配类型" prop="validity">
                    <el-select v-model="filters.auto" filterable clearable placeholder="请选择运有效期">
                        <el-option value="" label="全部">全部</el-option>
                        <el-option value="0" label="自动">自动</el-option>
                        <el-option value="1" label="手动">手动</el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="产品状态" prop="validity">
                    <el-select v-model="filters.status" clearable filterable placeholder="请选择产品状态">
                        <el-option value="" label="全部">全部</el-option>
                        <el-option value="2" label="禁用">禁用</el-option>
                        <el-option value="1" label="正常">正常</el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="面值">
<!--                    <el-input v-model="filters.downfacevalue" clearable placeholder="面值"></el-input>-->
                    <el-select v-model="filters.downfacevalue" clearable filterable collapse-tags multiple placeholder="请面值">
                        <el-option value="0" label="全部">全部</el-option>
                        <el-option
                                v-for="item in downfacevalues"
                                :key="item.id"
                                :label="item.id"
                                :value="item.id">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="折扣">
                    <el-input v-model="filters.discount" clearable placeholder="折扣"></el-input>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" v-on:click="downProductFind">查询</el-button>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" @click="exportDownProduct">导出</el-button>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" v-show="isShow" @click="handleAdd">新增</el-button>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" v-show="isShow" @click="handleBatchEdit">商户批量</el-button>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" v-show="isShow" @click="handleBatchEditAll">折扣批量</el-button>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" v-show="isShow" @click="handleBatchUpProduct">批量匹配产品</el-button>
                </el-form-item>
<!--                <el-form-item>-->
<!--                    <el-button type="primary" v-show="isShow" @click="handleBatchPhoneEdit">批量话费修改</el-button>-->
<!--                </el-form-item>-->
                <el-form-item>
                    <el-button type="primary" v-show="isShow" @click="handleBatchAuto">批量自动产品</el-button>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" v-show="isShow" @click="handleBatchOpen">批量开启产品</el-button>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" v-show="isShow" @click="handleBatchClose">批量禁用产品</el-button>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" @click="timerPrice">定时调价</el-button>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" @click="copyProduct">复制产品</el-button>
                </el-form-item>
            </el-form>
        </el-col>

        <!--列表-->
        <el-table :data="products" highlight-current-row v-loading="listLoading"  @selection-change="selsChange" show-overflow-tooltip="true" max-height="620" border style="width: 100%;">
            <el-table-column  type="selection" width="65" label="编号">
            </el-table-column>
            <el-table-column prop="operators.operatorname" width="100px"  label="运营商">
            </el-table-column>
            <el-table-column prop="provincialInformation.provincename" label="省份">
            </el-table-column>
            <el-table-column prop="cityName" label="地市">
            </el-table-column>
            <el-table-column prop="businessType.busname"  width="110px"  label="业务类型" show-overflow-tooltip>
            </el-table-column>
            <el-table-column prop="auto" label="匹配策略"   width="120px" :formatter="productAuto">
            </el-table-column>
            <el-table-column prop="user.username"  width="130px"  label="分销商" show-overflow-tooltip>
            </el-table-column>
            <el-table-column prop="downprouuid" width="200px" label="产品编码" show-overflow-tooltip>
            </el-table-column>
	        <el-table-column prop="price"  width="110px" label="原价">
            </el-table-column>
            <el-table-column prop="downfacevalue"  width="120px" label="面值" :formatter="productType">
            </el-table-column>

<!--            <el-table-column prop="productCode" label="虚拟编码" width="130px">-->
<!--            </el-table-column>-->
            <el-table-column prop="productName" label="产品名称" width="130px" show-overflow-tooltip>
            </el-table-column>

            <el-table-column prop="discount"  width="100px" label="实际折扣">
            </el-table-column>
            <el-table-column prop="discountAmount"  width="110px" label="实际金额">
            </el-table-column>
<!--            <el-table-column prop="validity" label="有效期":formatter="fastchargevalidity" >-->
<!--            </el-table-column>-->
            <el-table-column prop="status" label="状态" :formatter="status">
            </el-table-column>

            <el-table-column prop="remark" label="备注" show-overflow-tooltip>
            </el-table-column>
            <el-table-column label="操作"   fixed="right" v-show="isShow" width="280">
                <template scope="scope" v-show="isShow">
                    <el-button size="small" v-show="isShow" @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
                    <el-button size="small" v-show="isShow" @click="matchStrategy(scope.$index, scope.row)">匹配策略
                    </el-button>
                    <el-button size="small" v-show="isShow" @click="handleEnable(scope.$index, scope.row)">
                        {{scope.row.status == 2 ? '启用' : '禁用'}}
                    </el-button>
                    <el-button size="small" v-show="isShow" @click="deleteEnable(scope.$index, scope.row)">
                        删除
                    </el-button>
                </template>
            </el-table-column>
        </el-table>

        <!--工具条-->
        <el-pagination
                @current-change="handleCurrentChange"
                @size-change="handleSizeChange"
                layout="total,sizes,prev, pager, next"
                :total="total">
        </el-pagination>
        <!--编辑界面-->
        <el-dialog title="编辑分销商产品" size="small" v-model="editFormVisible" :close-on-click-modal="false">
            <el-form :model="editForm" label-width="100px" :inline="true" :rules="editFormRules" ref="editForm">
                <el-form-item label="运营商" prop="operatoruid">
                    <el-select v-model="editForm.operatoruid" filterable placeholder="请选择运营商">
                        <el-option
                                v-for="item in operator"
                                :key="item.operatoruid"
                                :label="item.operatorname"
                                :value="item.operatoruid">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="省份" prop="provinceuuid">
                    <el-select v-model="editForm.provinceuuid" filterable @change="selectCity(editForm.provinceuuid)" placeholder="请选择省份">
                        <el-option
                                v-for="item in info"
                                :key="item.provinceuuid"
                                :label="item.provincename"
                                :value="item.provinceuuid">
                        </el-option>
                    </el-select>
                </el-form-item>

                <el-form-item label="城市" prop="provinceuuid">
                    <el-select v-model="editForm.cityName" filterable clearable placeholder="请选择地市">
                        <el-option
                                v-for="item in citys"
                                :key="item.cityName"
                                :label="item.cityName"
                                :value="item.cityName">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="业务类型" prop="busuuid">
                    <el-select v-model="editForm.busuuid" filterable placeholder="请选择业务类型">
                        <el-option
                                v-for="item in bus"
                                :key="item.busuuid"
                                :label="item.busname"
                                :value="item.busuuid">
                        </el-option>
                    </el-select>
                </el-form-item>

                <el-form-item label="分销商" prop="useruuid">
                    <el-select v-model="editForm.useruuid" filterable placeholder="请选择分销商">
                        <el-option
                                v-for="item in users"
                                :key="item.user.useruuid"
                                :label="item.user.username"
                                :value="item.user.useruuid">
                        </el-option>
                    </el-select>
                </el-form-item>

                <el-form-item label="产品名称" prop="productName"  >
                    <el-input style="width: 216px;" v-model="editForm.productName"></el-input>
                </el-form-item>
                <el-form-item label="原价" prop="price">
                    <el-input v-model="editForm.price" style="width: 216px;" v-on:input="discountChangeEdit"></el-input>
                </el-form-item>
                <el-form-item label="面值"   prop="downfacevalue">
                    <el-input width="290px" style="width: 216px;" placeholder="如10话费"  v-model="editForm.downfacevalue"></el-input>
                </el-form-item>
                <el-form-item label="折扣" prop="discount">
                    <el-input v-model="editForm.discount" style="width: 216px;" v-on:input="discountChangeEdit"></el-input>
                </el-form-item>
<!--                <el-form-item label="成本金额"  label-width="135px"  prop="discount">-->
<!--                    <el-input v-model="editForm.discountAmount" :disabled="true"></el-input>-->
<!--                </el-form-item>-->
<!--                <el-form-item label="有效期" prop="validity">-->
<!--                    <el-select v-model="editForm.validity" placeholder="请选择有效期">-->
<!--                        <el-option value="0" label="全部">全部</el-option>-->
<!--                        <el-option value="1" label="30天">30天</el-option>-->
<!--                        <el-option value="2" label="当月">当月</el-option>-->
<!--                    </el-select>-->
<!--                </el-form-item>-->

                <el-form-item label="备注">
                    <el-input type="textarea" width="500px;" style="width: 216px;" v-model="editForm.remark"></el-input>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click.native="editFormVisible = false">取消</el-button>
                <el-button type="primary" @click.native="editSubmit" :loading="editLoading">提交</el-button>
            </div>
        </el-dialog>

        <!--批量新增界面-->
        <el-dialog title="批量新增分销商产品" size="small"  v-model="addFormVisible" :close-on-click-modal="false">
            <el-form :model="addForm" label-width="100px" :inline="true" :rules="addFormRules" ref="addForm">
                <el-form-item label="运营商" prop="operatoruid">
                    <el-select v-model="addForm.operatoruid" filterable @change="changeOperator" placeholder="请选择运营商">
                        <el-option
                                v-for="item in operator"
                                :key="item.operatoruid"
                                :label="item.operatorname"
                                :value="item.operatoruid">
                        </el-option>
                    </el-select>
                </el-form-item>

                <el-form-item label="省份" prop="provinceuuid">
                    <el-select v-model="addForm.provinceuuid" filterable @change="selectCity(addForm.provinceuuid)"  placeholder="请选择省份">
                        <el-option
                                v-for="item in info"
                                :key="item.provinceuuid"
                                :label="item.provincename"
                                :value="item.provinceuuid">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="城市" >
                    <el-select v-model="addForm.cityName" filterable clearable placeholder="请选择地市">
                        <el-option
                                v-for="item in citys"
                                :key="item.cityName"
                                :label="item.cityName"
                                :value="item.cityName">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="业务类型" prop="busuuid">
                    <el-select v-model="addForm.busuuid" filterable placeholder="请选择业务类型">
                        <el-option
                                v-for="item in bus"
                                :key="item.busuuid"
                                :label="item.busname"
                                :value="item.busuuid">
                        </el-option>
                    </el-select>
                </el-form-item>

                <el-form-item label="分销商" prop="useruuid">
                    <el-select v-model="addForm.useruuid" filterable placeholder="请选分销商">
                        <el-option
                                v-for="item in users"
                                :key="item.user.useruuid"
                                :label="item.user.username"
                                :value="item.user.useruuid">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="折扣"    prop="unitPrice">
                    <el-input v-model="addForm.unitPrice" style="width: 216px;" v-on:input="discountChangeAdd"></el-input>
                </el-form-item>
<!--                <el-form-item label="流量类型" label-width="120px">-->
<!--                    <el-radio-group v-model="addForm.packagetype">-->
<!--                        <el-radio  :label="1">流量池</el-radio>-->
<!--                        <el-radio  :label="0">包型</el-radio>-->
<!--                    </el-radio-group>-->
<!--                </el-form-item>-->
               <el-row>
                   <el-form-item label="话费包型" prop="channe">
                       <el-checkbox-group v-model="addForm.channe"  style="margin-left:5px;"  @change="handleCheckedChange">
                           <el-checkbox v-for="channel in channels" :label="channel.basePrice" :key="channel.baseId">{{channel.baseName}}</el-checkbox>
                       </el-checkbox-group>
                   </el-form-item>
               </el-row>


                <el-table :data="setProducts"  show-overflow-tooltip="true"  @cell-click="batchCellclick" @cell-mouse-leave="batchCellmouseleave" max-height="620"  border style="width: 100%;">
                    <el-table-column type="index" width="80" label="编号">
                    </el-table-column>
<!--                    <el-table-column prop="productCode" label="虚拟编码" show-overflow-tooltip width="130px">-->
<!--                    </el-table-column>-->
                    <el-table-column prop="productName" label="产品名称" show-overflow-tooltip width="130px">
                    </el-table-column>
                    <el-table-column prop="downfacevalue"  width="100px" label="面值" :formatter="downfacevalueProduct" >
                    </el-table-column>
                    <el-table-column prop="price"  width="110px" label="原价"   :formatter="downfacevalueprice">
                    </el-table-column>
                    <el-table-column prop="discount"  width="100px" show-overflow-tooltip label="实际折扣">
                    </el-table-column>
                    <el-table-column prop="discountAmount" show-overflow-tooltip  label="实际金额">
                    </el-table-column>
                </el-table>

            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click.native="addFormVisible = false">取消</el-button>
                <el-button type="primary" @click.native="addUpProduct" :loading="addLoading">提交</el-button>
            </div>
        </el-dialog>

        <!--批量修改界面-->
        <el-dialog title="批量编辑分销商产品" size="small"   v-model="batchFormVisible" :close-on-click-modal="false">
            <el-form :model="batchForm" label-width="100px" :inline="true" :rules="batchFormRules" ref="batchForm">
                <el-form-item label="运营商" prop="operatoruid">
                    <el-select v-model="batchForm.operatoruid" filterable  :disabled="true" @change="changeOperator" placeholder="请选择运营商">
                        <el-option
                                v-for="item in operator"
                                :key="item.operatoruid"
                                :label="item.operatorname"
                                :value="item.operatoruid">
                        </el-option>
                    </el-select>

                </el-form-item>

                <el-form-item label="省份" prop="provinceuuid">
                    <el-select v-model="batchForm.provinceuuid"  filterable :disabled="true" @change="selectCity(batchForm.provinceuuid)"  placeholder="请选择省份">
                        <el-option
                                v-for="item in info"
                                :key="item.provinceuuid"
                                :label="item.provincename"
                                :value="item.provinceuuid">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="地市"  >
                    <el-select v-model="batchForm.cityName" filterable :disabled="true" clearable placeholder="请选择地市">
                        <el-option
                                v-for="item in citys"
                                :key="item.cityName"
                                :label="item.cityName"
                                :value="item.cityName">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="业务类型" prop="busuuid">
                    <el-select v-model="batchForm.busuuid" filterable :disabled="true" placeholder="请选择业务类型">
                        <el-option
                                v-for="item in bus"
                                :key="item.busuuid"
                                :label="item.busname"
                                :value="item.busuuid">
                        </el-option>
                    </el-select>
                </el-form-item>

                <el-form-item label="分销商" >
                    <el-select v-model="batchForm.useruuid"   :disabled="true" multiple collapse-tags clearable placeholder="请选分销商">
                        <el-option
                                v-for="item in users"
                                :key="item.user.useruuid"
                                :label="item.user.username"
                                :value="item.user.useruuid">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="折扣"  prop="unitPrice">
                    <el-input v-model="batchForm.unitPrice" style="width: 216px;" v-on:input="discountBatchChangeAdd"></el-input>
                </el-form-item>
<!--                <el-form-item label="流量类型" label-width="120px">-->
<!--                    <el-radio-group v-model="batchForm.packagetype">-->
<!--                        <el-radio  :label="1">流量池</el-radio>-->
<!--                        <el-radio  :label="0">包型</el-radio>-->
<!--                    </el-radio-group>-->
<!--                </el-form-item>-->
                <el-form-item label="话费包型" prop="channe">
                    <el-checkbox-group v-model="batchForm.channe" @change="handleBatchCheckedChange">
                        <el-checkbox v-for="channel in channels" :disabled="true" :label="channel.basePrice" :key="channel.baseId">{{channel.baseName}}</el-checkbox>
                    </el-checkbox-group>
                </el-form-item>


                <el-table :data="setBatchProducts"  show-overflow-tooltip="true"  @cell-click="cellclick" @cell-mouse-leave="cellmouseleave" max-height="620" border style="width: 100%;">
                    <el-table-column type="index" width="80" label="编号">
                    </el-table-column>
<!--                    <el-table-column prop="productCode" label="虚拟编码" show-overflow-tooltip width="130px">-->
<!--                    </el-table-column>-->
                    <el-table-column prop="productName" label="产品名称" show-overflow-tooltip width="130px">
                    </el-table-column>
                    <el-table-column prop="downfacevalue"  width="100px" label="面值" :formatter="downfacevalueProduct" >
                    </el-table-column>
                    <el-table-column prop="price"  width="110px" label="原价"   :formatter="downfacevalueprice">
                    </el-table-column>
                    <el-table-column prop="discount"  width="100px" show-overflow-tooltip label="实际折扣">
                    </el-table-column>
                    <el-table-column prop="discountAmount" show-overflow-tooltip label="实际金额">
                    </el-table-column>

                </el-table>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click.native="batchFormVisible = false">取消</el-button>
                <el-button type="primary" @click.native="batchEditDownProduct" :loading="batchLoading">提交</el-button>
            </div>
        </el-dialog>

        <!--all-->
        <el-dialog title="批量编辑分销商产品" size="small"   v-model="batchFormVisibleAll" :close-on-click-modal="false">
            <el-form :model="batchForm" label-width="100px" :inline="true" :rules="batchFormRules" ref="batchForm">
                <el-form-item label="运营商" prop="operatoruid">
                    <el-select v-model="batchForm.operatoruid" filterable :disabled="true" @change="changeOperator" placeholder="请选择运营商">
                        <el-option
                                v-for="item in operator"
                                :key="item.operatoruid"
                                :label="item.operatorname"
                                :value="item.operatoruid">
                        </el-option>
                    </el-select>

                </el-form-item>

                <el-form-item label="省份" prop="provinceuuid">
                    <el-select v-model="batchForm.provinceuuid" filterable :disabled="true" @change="selectCity(batchForm.provinceuuid)"  placeholder="请选择省份">
                        <el-option
                                v-for="item in info"
                                :key="item.provinceuuid"
                                :label="item.provincename"
                                :value="item.provinceuuid">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="地市"  >
                    <el-select v-model="batchForm.cityName" filterable  :disabled="true" clearable placeholder="请选择地市">
                        <el-option
                                v-for="item in citys"
                                :key="item.cityName"
                                :label="item.cityName"
                                :value="item.cityName">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="业务类型" prop="busuuid">
                    <el-select v-model="batchForm.busuuid" filterable  :disabled="true" placeholder="请选择业务类型">
                        <el-option
                                v-for="item in bus"
                                :key="item.busuuid"
                                :label="item.busname"
                                :value="item.busuuid">
                        </el-option>
                    </el-select>
                </el-form-item>

                    <el-form-item label="分销商" >
                        <el-select v-model="batchForm.useruuid" filterable multiple collapse-tags :disabled="true" placeholder="请选分销商">
                            <el-option
                                    v-for="item in users"
                                    :key="item.user.useruuid"
                                    :label="item.user.username"
                                    :value="item.user.useruuid">
                            </el-option>
                        </el-select>
                    </el-form-item>
                <el-form-item label="折扣"  prop="unitPrice">
                    <el-input v-model="batchForm.unitPrice" style="width: 216px;" v-on:input="discountBatchChangeAddAll"></el-input>
                </el-form-item>
                <el-table :data="setBatchProductsAll"  show-overflow-tooltip="true" max-height="620"  @cell-click="cellclick" @cell-mouse-leave="cellmouseleave"  border style="width: 100%;">
                    <el-table-column type="index" width="80" label="编号">
                    </el-table-column>
                    <!--                    <el-table-column prop="productCode" label="虚拟编码" show-overflow-tooltip width="130px">-->
                    <!--                    </el-table-column>-->
                    <el-table-column prop="productName" label="产品名称" show-overflow-tooltip width="130px">
                    </el-table-column>
                    <el-table-column prop="downfacevalue"  width="100px" label="面值" :formatter="downfacevalueProduct" >
                    </el-table-column>
                    <el-table-column prop="price"  width="110px" label="原价"   :formatter="downfacevalueprice">
                    </el-table-column>
                    <el-table-column prop="discount"  width="100px" show-overflow-tooltip label="实际折扣">
                    </el-table-column>
                    <el-table-column prop="discountAmount" show-overflow-tooltip label="实际金额">
                    </el-table-column>

                </el-table>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click.native="batchFormVisibleAll = false">取消</el-button>
                <el-button type="primary" @click.native="batchEditDownProductAll" :loading="batchLoading">提交</el-button>
            </div>
        </el-dialog>

        <el-dialog title="产品匹配策略" size="big" v-model="matchVisible" :close-on-click-modal="false">
            <el-form :model="matchForm" :inline="true" label-width="100px" :rules="matchRules" ref="matchForm">
                <el-form-item label="运营商" prop="operatoruid">
                    <el-select v-model="matchForm.operatoruid" filterable clearable placeholder="请选择运营商">
                        <el-option value="0" label="全部">全部</el-option>
                        <el-option
                                v-for="item in operator"
                                :key="item.operatoruid"
                                :label="item.operatorname"
                                :value="item.operatoruid">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="省份" prop="provinceuuid">
                    <el-select v-model="matchForm.provinceuuid"  filterable @change="selectCity(matchForm.provinceuuid)" clearable placeholder="请选择省份">
                        <el-option value="0" label="全部">全部</el-option>
                        <el-option
                                v-for="item in info"
                                :key="item.provinceuuid"
                                :label="item.provincename"
                                :value="item.provinceuuid">
                        </el-option>
                    </el-select>
                </el-form-item>

                <el-form-item label="地市"  >
                    <el-select v-model="matchForm.cityName" clearable filterable placeholder="请选择地市">
                        <el-option
                                v-for="item in citys"
                                :key="item.cityName"
                                :label="item.cityName"
                                :value="item.cityName">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="业务类型" prop="busuuid">
                    <el-select v-model="matchForm.busuuid" clearable filterable placeholder="请选择业务类型">
                        <el-option value="0" label="全部">全部</el-option>
                        <el-option
                                v-for="item in bus"
                                :key="item.busuuid"
                                :label="item.busname"
                                :value="item.busuuid">
                        </el-option>
                    </el-select>
                </el-form-item>

                <el-form-item label="供货商" prop="useruuid">
                    <el-select v-model="matchForm.useruuid" clearable filterable @change="changeBatchUser" placeholder="请选择供货商">
                        <el-option
                                v-for="item in usersUp"
                                :key="item.user.useruuid"
                                :label="item.user.username"
                                :value="item.user.useruuid">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="面值">
<!--                    <el-input style="width:220px;" clearable v-model="" clearable placeholder="面值"></el-input>-->
                    <el-select v-model="matchForm.upfacevalue" clearable filterable collapse-tags multiple placeholder="请面值">
                        <el-option
                                v-for="item in downfacevalues"
                                :key="item.id"
                                :label="item.id"
                                :value="item.id">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" v-on:click="downProductMatchFind">查询</el-button>
                </el-form-item>
                <el-row style="color: red;margin-bottom: 10px;">
                    <span>选择需要手动匹配的供货商,手动匹配后该分销商产品将直接匹配该供货商产品进行业务充值</span>
                </el-row>
                <!--列表-->
                <el-table :data="upproducts" highlight-current-row v-loading="listLoading" border @select="selectTable" max-height="620" ref="multipleTable" show-overflow-tooltip="true"
                          @selection-change="handleSelectionChangeBatch" style="width: 100%;">
                    <el-table-column type="selection" width="55"  >
                    </el-table-column>
                    <el-table-column prop="operators.operatorname"  width="100px" label="运营商">
                    </el-table-column>
                    <el-table-column prop="provincialInformation.provincename" label="省份">
                    </el-table-column>
                    <el-table-column prop="businessType.busname"  width="100px" label="业务类型">
                    </el-table-column>
                    <el-table-column prop="user.username" width="120px" label="供货商">
                    </el-table-column>
                    <el-table-column prop="productCode" show-overflow-tooltip  width="120px" label="产品编码">
                    </el-table-column>
                    <el-table-column prop="productName" show-overflow-tooltip  width="130px" label="产品名称">
                    </el-table-column>
                    <el-table-column prop="price"  width="120px" label="原价">
                    </el-table-column>
                    <el-table-column prop="upfacevalue" label="面值"  width="100px" :formatter="productUp">
                    </el-table-column>
                    <el-table-column prop="discount"   width="100px" label="实际折扣">
                    </el-table-column>
                    <el-table-column prop="discountAmount"   width="100px" label="实际金额" show-overflow-tooltip>
                    </el-table-column>
                    <!--<el-table-column prop="fastchargetype" label="快慢类型":formatter="fastchargetype" >-->
                    <!--</el-table-column>-->
                    <el-table-column prop="status" label="状态" :formatter="status">
                    </el-table-column>
                </el-table>

                <!--工具条-->
                <el-pagination
                        @current-change="handleCurrentChangeMatch"
                        @size-change="handleSizeChangeMatch"
                        layout="total,sizes,prev, pager, next"
                        :total="totalMatch">
                </el-pagination>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click.native="matchVisible = false">取消</el-button>
                <el-button type="primary" @click.native="saveMatch" :loading="matchFormLoading">保存策略</el-button>
            </div>
        </el-dialog>

        <el-dialog title="定时调价" size="big" v-model="matchFormBatchLoading" :close-on-click-modal="false">
            <el-form :model="matchBatchForm" :inline="true" label-width="100px" :rules="matchBatchRules" ref="matchBatchForm">
                <el-form-item label="运营商" prop="operatoruid">
                    <el-select v-model="matchBatchForm.operatoruid" placeholder="请选择运营商">
                        <el-option value="0" label="全部">全部</el-option>
                        <el-option
                                v-for="item in operator"
                                :key="item.operatoruid"
                                :label="item.operatorname"
                                :value="item.operatoruid">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="省份" prop="provinceuuid">
                    <el-select v-model="matchBatchForm.provinceuuid" @change="selectCity(matchBatchForm.provinceuuid)" placeholder="请选择省份">
                        <el-option value="0" label="全部">全部</el-option>
                        <el-option
                                v-for="item in info"
                                :key="item.provinceuuid"
                                :label="item.provincename"
                                :value="item.provinceuuid">
                        </el-option>
                    </el-select>
                </el-form-item>

                <el-form-item label="地市"  >
                    <el-select v-model="matchBatchForm.cityName"  clearable placeholder="请选择地市">
                        <el-option
                                v-for="item in citysMatchs"
                                :key="item.cityName"
                                :label="item.cityName"
                                :value="item.cityName">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="业务类型" prop="busuuid">
                    <el-select v-model="matchBatchForm.busuuid" placeholder="请选择业务类型">
                        <el-option value="0" label="全部">全部</el-option>
                        <el-option
                                v-for="item in bus"
                                :key="item.busuuid"
                                :label="item.busname"
                                :value="item.busuuid">
                        </el-option>
                    </el-select>
                </el-form-item>

                <el-form-item label="分销商" prop="useruuid">
                    <el-select v-model="matchBatchForm.useruuid"   clearable filterable  multiple  placeholder="请选择分销商">
                        <el-option
                                v-for="item in users"
                                :key="item.user.useruuid"
                                :label="item.user.username"
                                :value="item.user.useruuid">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="面值">
                    <el-select v-model="matchBatchForm.downfacevalue" clearable filterable  multiple placeholder="请面值">
                        <el-option value="0" label="全部">全部</el-option>
                        <el-option
                                v-for="item in downfacevalues"
                                :key="item.id"
                                :label="item.id"
                                :value="item.id">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" v-on:click="downProductMatchBatch">查询</el-button>
                </el-form-item>
                <el-row style="color: red;margin-bottom: 10px;">
                    <el-form-item label="注意">请选择执行时间点</el-form-item>
                    <el-form-item label="调价前折扣">
                        <el-input v-model="matchBatchForm.beforediscount" style="width: 75px;" clearable placeholder="折扣"></el-input>
                    </el-form-item>
                    <el-form-item label="调价后折扣">
                        <el-input v-model="matchBatchForm.afterdiscount" style="width: 75px;" v-on:input="batchTimerPriceInput" clearable placeholder="折扣"></el-input>
                    </el-form-item>
                    <el-form-item label="执行时间">
                        <el-date-picker type="datetime" placeholder="开始时间" format="yyyy-MM-dd HH:mm:ss"   v-model="matchBatchForm.executeTime" style="width: 100%;"></el-date-picker>
                    </el-form-item>
                    <el-form-item label="备注">
                        <el-input  type="datetime" placeholder="备注" format="yyyy-MM-dd HH:mm:ss" :maxlength="100"  v-model="matchBatchForm.note" style="width: 100%;"></el-input>
                    </el-form-item>
                </el-row>
                <!--列表-->
                <el-table :data="upproductsBatch" highlight-current-row v-loading="listLoading" max-height="470" border @select="selectTableTimer"
                          ref="multipleTableBatchTimer" show-overflow-tooltip="true" style="width: 100%"
                          @selection-change="handleSelectionChangeBatchTimer" >
                    <el-table-column type="selection"   >
                    </el-table-column>
                    <el-table-column type="index" width="70" label="编号">
                    </el-table-column>
                    <el-table-column prop="operators.operatorname" show-overflow-tooltip width="100px" label="运营商">
                    </el-table-column>
                    <el-table-column prop="provincialInformation.provincename" show-overflow-tooltip width="90px" label="省份">
                    </el-table-column>
                    <el-table-column prop="businessType.busname"  show-overflow-tooltip width="100px" label="业务类型">
                    </el-table-column>
                    <el-table-column prop="user.username" width="110px" show-overflow-tooltip label="分销商">
                    </el-table-column>
                    <el-table-column prop="downprouuid" show-overflow-tooltip width="120px"   label="产品编码">
                    </el-table-column>
                    <el-table-column prop="productName" show-overflow-tooltip  width="130px" label="产品名称">
                    </el-table-column>
                    <el-table-column prop="price"  width="110px" label="原价" show-overflow-tooltip>
                    </el-table-column>
                    <el-table-column prop="downfacevalue" label="面值"  width="100px" show-overflow-tooltip  :formatter="productType">
                    </el-table-column>
                    <el-table-column prop="discount"   width="100px" show-overflow-tooltip label="实际折扣">
                    </el-table-column>
                    <el-table-column prop="discountAmount"   width="100px" label="实际金额" show-overflow-tooltip>
                    </el-table-column>
                    <el-table-column prop="status" label="状态" width="80px" :formatter="status">
                    </el-table-column>
                </el-table>

                <!--工具条-->
                <el-pagination
                        @current-change="handleCurrentChangeMatchBatchTimer"
                        @size-change="handleSizeChangeMatchBatchTimer"
                        layout="total,sizes,prev, pager, next"
                        :page-size="pageSizeMatchBatchTimer"
                        :total="totalMatchBatch">
                </el-pagination>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click.native="matchFormBatchLoading = false">取消</el-button>
                <el-button type="primary" @click.native="saveBatchPrice" :loading="matchFormLoading">保存调价</el-button>
            </div>
        </el-dialog>

        <el-dialog title="复制产品" size="big" v-model="copyFormBatchLoading" :close-on-click-modal="false">
            <el-form :model="copyBatchForm" :inline="true" label-width="100px" :rules="matchBatchRules" ref="copyBatchForm">
                <el-form-item label="运营商" prop="operatoruid">
                    <el-select v-model="copyBatchForm.operatoruid" placeholder="请选择运营商">
                        <el-option value="0" label="全部">全部</el-option>
                        <el-option
                                v-for="item in operator"
                                :key="item.operatoruid"
                                :label="item.operatorname"
                                :value="item.operatoruid">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="省份" prop="provinceuuid">
                    <el-select v-model="copyBatchForm.provinceuuid" @change="selectCity(copyBatchForm.provinceuuid)" placeholder="请选择省份">
                        <el-option value="0" label="全部">全部</el-option>
                        <el-option
                                v-for="item in info"
                                :key="item.provinceuuid"
                                :label="item.provincename"
                                :value="item.provinceuuid">
                        </el-option>
                    </el-select>
                </el-form-item>

                <el-form-item label="地市"  >
                    <el-select v-model="copyBatchForm.cityName"  clearable placeholder="请选择地市">
                        <el-option
                                v-for="item in citysMatchs"
                                :key="item.cityName"
                                :label="item.cityName"
                                :value="item.cityName">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="业务类型" prop="busuuid">
                    <el-select v-model="copyBatchForm.busuuid" placeholder="请选择业务类型">
                        <el-option value="0" label="全部">全部</el-option>
                        <el-option
                                v-for="item in bus"
                                :key="item.busuuid"
                                :label="item.busname"
                                :value="item.busuuid">
                        </el-option>
                    </el-select>
                </el-form-item>

                <el-form-item label="分销商" prop="useruuid">
                    <el-select v-model="copyBatchForm.useruuid"   clearable filterable  multiple  placeholder="请选择分销商">
                        <el-option
                                v-for="item in users"
                                :key="item.user.useruuid"
                                :label="item.user.username"
                                :value="item.user.useruuid">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="面值">
                    <el-select v-model="copyBatchForm.downfacevalue" clearable filterable  multiple placeholder="请面值">
                        <el-option value="0" label="全部">全部</el-option>
                        <el-option
                                v-for="item in downfacevalues"
                                :key="item.id"
                                :label="item.id"
                                :value="item.id">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="复制分销商" prop="useruuid">
                    <el-select v-model="copyBatchForm.touseruuid"   clearable filterable   placeholder="请选择分销商">
                        <el-option
                                v-for="item in users"
                                :key="item.user.useruuid"
                                :label="item.user.username"
                                :value="item.user.useruuid">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" v-on:click="copyProductMatchBatch">查询</el-button>
                </el-form-item>

                <!--列表-->
                <el-table :data="copyproductsBatch" highlight-current-row v-loading="listLoading" max-height="470" border @select="selectTableTimer"
                          ref="multipleTableBatchTimer" show-overflow-tooltip="true" style="width: 100%"
                          @selection-change="handleSelectionChangeBatchCopy" >
                    <el-table-column type="selection"   >
                    </el-table-column>
                    <el-table-column type="index" width="70" label="编号">
                    </el-table-column>
                    <el-table-column prop="operators.operatorname" show-overflow-tooltip width="100px" label="运营商">
                    </el-table-column>
                    <el-table-column prop="provincialInformation.provincename" show-overflow-tooltip width="90px" label="省份">
                    </el-table-column>
                    <el-table-column prop="businessType.busname"  show-overflow-tooltip width="100px" label="业务类型">
                    </el-table-column>
                    <el-table-column prop="user.username" width="110px" show-overflow-tooltip label="分销商">
                    </el-table-column>
                    <el-table-column prop="downprouuid" show-overflow-tooltip width="120px"   label="产品编码">
                    </el-table-column>
                    <el-table-column prop="productName" show-overflow-tooltip  width="130px" label="产品名称">
                    </el-table-column>
                    <el-table-column prop="price"  width="110px" label="原价" show-overflow-tooltip>
                    </el-table-column>
                    <el-table-column prop="downfacevalue" label="面值"  width="100px" show-overflow-tooltip  :formatter="productType">
                    </el-table-column>
                    <el-table-column prop="discount"   width="100px" show-overflow-tooltip label="实际折扣">
                    </el-table-column>
                    <el-table-column prop="discountAmount"   width="100px" label="实际金额" show-overflow-tooltip>
                    </el-table-column>
                    <el-table-column prop="status" label="状态" width="80px" :formatter="status">
                    </el-table-column>
                </el-table>

                <!--工具条-->
                <el-pagination
                        @current-change="handleCurrentChangeMatchBatchCopy"
                        @size-change="handleSizeChangeMatchBatchCopy"
                        layout="total,sizes,prev, pager, next"
                        :page-size="pageSizeMatchBatchCopy"
                        :total="totalMatchBatchCopy">
                </el-pagination>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click.native="copyFormBatchLoading = false">取消</el-button>
                <el-button type="primary" @click.native="saveBatchCopy" :loading="matchFormLoading">保存产品</el-button>
            </div>
        </el-dialog>
    </section>
</template>

<script>
    import util from '../../common/js/util'
    var pinyin = require("pinyin");
    //import NProgress from 'nprogress'
    import {
        downProductFind,
        exportDownProduct,
        findByDownProvince,
        findOpeProBusShop,
        addDownBatchProduct,
        copyDownBatchProduct,
        findOneDownProduct,
        updateDownProduct,
        productDownEnable,
        findAllBus,
        findAllDownShopInfo,
        downProductMatchFind,
        findAllUpShopInfo,
        addProductStrategy,
        downfindlist,
        findByProductFetchInclu,
        findByChannel,
        findBatchEditDownProduct,
        batchEditDownProduct,
        editHandleBatchPhoneEdit,
        autoProduct, findAllCity,  handleBatchClose,
        batchEditDownProductAll,
        findAllChannel,
        batchProductTimer,
        deleteDownProduct
    } from '../../api/api';
    import moment from "moment";

    export default {
        data() {
            return {
                filters: {
                    name: '',
                    cityName:'',
                    downorderuuid:'',
                    provinceuuid:'',
                    operatoruid:'',
                    busuuid: '',
                    validity:'',
                    useruuid: '',
                    downfacevalue: [],
                    auto:'',
                    discount:'',
                    isShow: JSON.parse(sessionStorage.getItem("user")).usertype == 1 ? true : JSON.parse(sessionStorage.getItem("user")).usertype == 2 ? true : false
                },
                infoFilters:[],
                isShow: JSON.parse(sessionStorage.getItem("user")).usertype == 1 ? true : JSON.parse(sessionStorage.getItem("user")).usertype == 2 ? true :  false,
                products: [],
                channels:[],
                setProducts:[],
                setBatchProducts:[],
                setBatchPhoneProducts:[],
                setBatchProductsAll:[],
                downfacevalues:[],
                total: 0,
                start: 0,
                pageSize: 10,
                totalMatch: 0,
                sels:[],
                citys:[],
                //定时调价
                citysMatchs:[],
                startMatch: 0,
                //操作类型 1单个 2批量
                enumType:1,
                pageSizeMatch: 10,
                startMatchBatch: 0,
                pageSizeMatchBatch: 10,
                startMatchBatchTimer: 0,
                pageSizeMatchBatchTimer: 100,
                startMatchBatchCopy: 0,
                pageSizeMatchBatchCopy: 100,
                listLoading: false,
                matchForm: {
                    productCode: '',
                    operatoruid: '',
                    provinceuuid: '',
                    busuuid: '',
                    useruuid: '',
                    upfacevalue:[],
                    cityName:'',
                    downuuid:'',
                    province:''
                },
                matchFormLoading: false,
                matchVisible: false,
                matchRules: {},

                copyFormBatchLoading:false,
                copyBatchForm: {
                    productCode: '',
                    operatoruid: '',
                    provinceuuid: '',
                    busuuid: '',
                    useruuid: [],
                    downfacevalue:[],
                    downfailnum:'0',
                    fastchargetype:"1",
                    downtimeinterva: 1,
                    cityName:'',
                    discount:0,
                    beforediscount:0,
                    afterdiscount:1,
                    executeTime:moment().add('hour', 1).format('YYYY-MM-DD HH:mm:ss'),
                    note:'',
                    touseruuid:''
                },
                matchBatchForm: {
                    productCode: '',
                    operatoruid: '',
                    provinceuuid: '',
                    busuuid: '',
                    useruuid: [],
                    downfacevalue:[],
                    cityName:'',
                    discount:0,
                    beforediscount:0,
                    afterdiscount:1,
                    executeTime:moment().add('hour', 1).format('YYYY-MM-DD HH:mm:ss'),
                    note:''
                },
                matchFormBatchLoading: false,
                matchBatchVisible: false,
                matchBatchRules: {},
                totalMatchBatch:0,
                totalMatchBatchCopy:0,
                editFormVisible: false,//编辑界面是否显示
                editLoading: false,
                editFormRules: {
                    operatoruid: [
                        {required: true, message: '请选择运营商', trigger: 'blur'}
                    ],
                    provinceuuid: [
                        {required: true, message: '请选择省份', trigger: 'blur'}
                    ],
                    busuuid: [
                        {required: true, message: '请选择业务类型', trigger: 'blur'}
                    ],
                    useruuid: [
                        {required: true, message: '请选择渠道商', trigger: 'blur'}
                    ],
                    downfacevalue: [
                        {required: true, message: '请输入面值', trigger: 'blur'}
                    ],
                    productName: [
                        {required: true, message: '请输入产品名称', trigger: 'blur'}
                    ],
                    discount: [
                        {required: true, message: '请输入折扣', trigger: 'blur'},
                        {min: 1, max: 8, message: '长度在 1 到 3 个字符', trigger: 'blur'},
                    ],
                    fastchargetype: [
                        {required: true, message: '请选择快慢充类型', trigger: 'blur'}
                    ],price:[
                        {required: true, message: '请输入原价', trigger: 'blur'}
                    ]
                },
                //编辑界面数据
                editForm: {
                    operatoruid: '',
                    provinceuuid: '',
                    busuuid: '',
                    cityName:'',
                    user: {useruuid: ''},
                    productCode: '',
                    downfacevalue: '',
                    discount: '1',
                    fastchargetype: '1',
                    remark: '',
                    useruuid: [],
                    downtimeinterva: 1,
                    productName:'',
                    downprouuid: '',
                    price:"0",
                    discountAmount:'',
                    validity:'0',
                    downfailnum:0//重复提交次数
                },

                addFormVisible: false,//新增界面是否显示
                addLoading: false,
                addFormRules: {
                    operatoruid: [
                        {required: true, message: '请选择运营商', trigger: 'blur'}
                    ],
                    provinceuuid: [
                        {required: true, message: '请选择省份', trigger: 'blur'}
                    ],
                    busuuid: [
                        {required: true, message: '请选择业务类型', trigger: 'blur'}
                    ],
                    useruuid: [
                        {required: true, message: '请选择渠道商', trigger: 'blur'}
                    ],
                    downfacevalue: [
                        {required: true, message: '请输入面值,如果是话费则是对应的充值原价,如果是流量则是xxM', trigger: 'blur'}
                    ],
                    productCode: [
                        {required: true, message: '请输入产品名称', trigger: 'blur'}
                    ],
                    unitPrice: [
                        {required: true, message: '请输入单价', trigger: 'blur'},
                        {min: 1, max: 8, message: '长度在 1 到 3 个字符', trigger: 'blur'},
                    ],
                    fastchargetype: [
                        {required: true, message: '请选择快慢充类型', trigger: 'blur'}
                    ],
                    price:[
                        {required: true, message: '请输入原价', trigger: 'blur'}
                    ]

                },
                //新增界面数据
                addForm: {
                    operatoruid: '',
                    provinceuuid: '',
                    busuuid: '',
                    cityName:'',
                    user: {useruuid: ''},
                    productCode: '',
                    downfacevalue: '',
                    unitPrice: '1',
                    fastchargetype: '1',
                    remark: '',
                    useruuid: '',
                    downfailnum: 1,
                    downtimeinterva: 1,
                    price:'0',
                    discountAmount:'',
                    channe:[],
                    validity:'',
                    packagetype:1,
                    downfailnum:0//重复提交次数
                },
                //下拉数据
                operator: [],
                info: [],
                bus: [],
                users: [],
                usersUp:[],
                upproducts: [],
                upproductsBatch:[],
                copyproductsBatch:[],
                sels: [],
                selsBatch:[],
                selsBatchTimer:[],
                selsBatchCopy:[],
                matchProduct: {},
                ups:[],
                //批量修改
                batchFormVisible: false,
                batchLoading: false,
                batchFormVisibleAll : false,
                batchFormRules: {
                    operatoruid: [
                        {required: true, message: '请选择运营商', trigger: 'blur'}
                    ],
                    provinceuuid: [
                        {required: true, message: '请选择省份', trigger: 'blur'}
                    ],
                    busuuid: [
                        {required: true, message: '请选择业务类型', trigger: 'blur'}
                    ],
                    useruuid: [
                        {required: true, message: '请选择渠道商', trigger: 'blur'}
                    ],
                    downfacevalue: [
                        {required: true, message: '请输入面值,如果是话费则是对应的充值原价,如果是流量则是xxM', trigger: 'blur'}
                    ],
                    productCode: [
                        {required: true, message: '请输入产品名称', trigger: 'blur'}
                    ],
                    unitPrice: [
                        {required: true, message: '请输入单价', trigger: 'blur'},
                        {min: 1, max: 8, message: '长度在 1 到 3 个字符', trigger: 'blur'},
                    ],
                    fastchargetype: [
                        {required: true, message: '请选择快慢充类型', trigger: 'blur'}
                    ],
                    price:[
                        {required: true, message: '请输入原价', trigger: 'blur'}
                    ]
                },
                //批量修改
                batchForm: {
                    operatoruid: '',
                    provinceuuid: '',
                    busuuid: '',
                    cityName:'',
                    user: {useruuid: ''},
                    productCode: '',
                    downfacevalue: '',
                    unitPrice: '1',
                    fastchargetype: '1',
                    remark: '',
                    useruuid: '',
                    downfailnum: 1,
                    downtimeinterva: 1,
                    price:'0',
                    discountAmount:'',
                    channe:[],
                    packagetype:1,
                    downfailnum:0//重复提交次数
                },
            }
        },
        methods: {
            productAuto: function (row, column) {
                return (row.auto === 1) ? "手动匹配" : (row.auto === 0) ?  "自动匹配" : "未知";
            },
            fastchargevalidity:function(row, column){
                return (row.validity === "1") ? "30天" : (row.validity === "2") ?  "当月" : "未知";
            },
            productUp: function (row, column) {
                return (row.businessType.busname == "手机") ? (row.upfacevalue + '话费') : ( row.businessType.busname == "固话") ?  (row.upfacevalue + '话费') :(row.upfacevalue + '话费');
            },
            productType: function (row, column) {
                return (row.businessType.busname == "手机") ? (row.downfacevalue + '话费') : ( row.businessType.busname == "固话") ?  (row.downfacevalue + '话费') :(row.downfacevalue + '话费');
            },

            downfacevalueprice: function (row, column) {
                return row.price+"元";
            },
            downfacevalueProduct: function (row, column) {
                return row.downfacevalue+"元";
            },downfacevaluePhoneProduct:function (row, column) {
                return row.downfacevalue+"话费";
            },
            fastchargetype: function (row, column) {
                return row.fastchargetype == 1 ? '快充' : row.fastchargetype == 0 ? '慢充' : '未知';
            },
            status: function (row, column) {
                return row.status == "1" ? '正常' : row.status == "0" ? '删除' : row.status == "2" ? "禁用" : '未知';
            },
            selectfilter:function(row){
                this.filters.cityName = '';
                if(row != ""){
                    for(let str in this.info){
                        if(this.info[str].label == row){
                            this.filters.provinceuuid = this.info[str].provinceuuid;
                        }
                    }
                    this.findAllCity(row);
                }
            },selectTable:function (selection, row) {
                var temp = false;
                for(var i = 0 ; i < selection.lengh; i++){
                    if(selection[i].upprouuid = row.upprouuid){
                        temp = true;
                    }
                }
                if(!temp){
//                    this.$refs.multipleTable.toggleRowSelection(row,false);
                }
            },
            handleSelectionChange: function (sels) {
                this.sels = sels;
            },
            handleSelectionChangeBatch: function (sels) {
                this.selsBatch = sels;
            },
            downProductMatchBatch(row){
                let para = {
                    start: this.startMatchBatchTimer,
                    pageSize: this.pageSizeMatchBatchTimer,
                    provinceuuid:  this.matchBatchForm.provinceuuid == "0" ? "" : this.matchBatchForm.provinceuuid,
                    busuuid: this.matchBatchForm.busuuid == "0" ? "" : this.matchBatchForm.busuuid,
                    downfacevalue: (this.matchBatchForm.downfacevalue == "0" || this.matchBatchForm.downfacevalue.length == 0)? "" : this.matchBatchForm.downfacevalue  ,
                    useruuid: (this.matchBatchForm.useruuid == "0" || this.matchBatchForm.useruuid.length == 0) ? "": this.matchBatchForm.useruuid,
                    operatoruid: this.matchBatchForm.operatoruid == "0" ? "": this.matchBatchForm.operatoruid,
                    downprouuid: '',
                    fastchargetype: '',
                    validity: "",
                    cityName: this.matchBatchForm.cityName,
                    auto: "",
                    status: "",
                    discount:this.filters.discount
                };
                this.listLoading = false;
                downProductFind(para).then((datas) => {
                    let {message, code, data} = datas;
                    if (code !== "0") {
                        this.$message({
                            message: message,
                            type: 'error'
                        });
                    } else if(data && data.result) {
                        this.upproductsBatch = data.result;
                        this.totalMatchBatch = data.totalCount;
                        //检查所有产品折扣是否相同
                        if(this.checkProductDiscount(this.upproductsBatch)){
                            this.$message({
                                message: "当前选中产品折扣不相同，请注意检查",
                                type: 'info'
                            });
                        };
                    }
                    this.listLoading = false;
                });
            },
            downProductMatchFind: function (row) {
                let para = {
                    start: this.startMatch,
                    pageSize: this.pageSizeMatch,
                    busuuid: this.matchForm.busuuid == "0" ? "" : this.matchForm.busuuid,
                    operatoruid: this.matchForm.operatoruid == "0" ? "" : this.matchForm.operatoruid,
                    provinceuuid: this.matchForm.provinceuuid == "0" ? "" : this.matchForm.provinceuuid,
                    useruuids: (this.matchForm.useruuid == "0" || !this.matchForm.useruuid) ? "" : this.matchForm.useruuid,
                    upfacevalue: this.matchForm.upfacevalue ? this.matchForm.upfacevalue : '',
                    downprouuid : row ? row.downprouuid : ""
                };
                this.listLoading = false;
                downProductMatchFind(para).then((datas) => {
                    let {message, code, data} = datas;
                    if (code !== "0") {
                        this.$message({
                            message: message,
                            type: 'error'
                        });
                    } else {
                        this.upproducts = data.result;
                        this.totalMatch = data.totalCount;
                        if(!this.users){
                            this.$message({
                                message: '请刷新后在试',
                                type: 'error'
                            });
                        }
                        //查询下游用户id
                        const upResult = this.users.find( item => {return item.user.username == this.matchProduct.user.username});
                        if(upResult){
                            this.matchForm.downuuid = upResult.user.useruuid;
                        }
                        //查询上游产品id 或者名称
                        //"downuuid","operatoruid","provinceuuid","busuuid"
                        setTimeout(()=>{
                            for(var i  = 0 ; i < this.upproducts.length; i++) {
                                if (this.upproducts[i].remark == this.matchProduct.downprouuid) {
                                    this.$refs.multipleTable.toggleRowSelection(this.upproducts[i], true);
                                }
                            }
                        },1000);
                    }
                    this.listLoading = false;
                });
            },
            handleCurrentChangeMatch: function (val) {
                this.startMatch = val - 1;
                this.downProductMatchFind();
            },
            handleSizeChangeMatch: function (val) {
                this.pageSizeMatch = val;
                this.downProductMatchFind();
            },
            handleCurrentChangeMatchBatch: function (val) {
                this.startMatchBatch = val - 1;
                this.downProductMatchBatch();
            },
            handleSizeChangeMatchBatch: function (val) {
                this.pageSizeMatchBatch = val;
                this.downProductMatchBatch();
            },

            handleEnable: function (index, row) {

                this.$confirm('确认更新该产品状态吗?', '提示', {
                    type: 'warning'
                }).then(() => {
                    this.listLoading = true;
                    let para = {
                        downprouuid: row.downprouuid,
                        status: row.status == "2" ? "1" : "2",
                        useruuid: JSON.parse(sessionStorage.getItem("user")).useruuid
                    };
                    productDownEnable(para).then((res) => {
                        this.listLoading = false;
                        //NProgress.done();
                        this.$message({
                            message: '操作成功',
                            type: 'success'
                        });
                        this.downProductFind();
                    });
                }).catch(() => {

                });
            }, findAllDownShopInfo: function () {
                let para = {useruuid: JSON.parse(sessionStorage.getItem("user")).useruuid};
                findAllDownShopInfo(para).then(datas => {
                    let {message, code, data} = datas;
                    if (code !== "0") {
                        this.$message({
                            message: message,
                            type: 'error'
                        });
                    } else if(data) {
                        this.users = data;
                    }
                });
            },
            findAllUpShopInfo: function () {
                let para = {useruuid: ''};
                findAllUpShopInfo(para).then(datas => {
                    let {message, code, data} = datas;
                    if (code !== "0") {
                        this.$message({
                            message: message,
                            type: 'error'
                        });
                    } else {
                        this.usersUp = data;
                    }
                });
            },
            downfindlist:function(){
                downfindlist().then(datas =>{
                    let { message, code, data } = datas;
                    if (code !== "0") {
                        this.$message({
                            message: message,
                            type: 'error'
                        });
                    } else {
                        this.ups =   data;
                    }
                });
            },
            downProductFind() {
                let para = {
                    start: this.start,
                    pageSize: this.pageSize,
                    provinceuuid:  this.filters.provinceuuid == "0" ? "" : this.filters.provinceuuid,
                    busuuid: this.filters.busuuid == "0" ? "" : this.filters.busuuid,
//                  useruuid:JSON.parse(sessionStorage.getItem("user")).useruuid ,
                    downfacevalue: (this.filters.downfacevalue == "0" || this.filters.downfacevalue.length == 0)? "" : this.filters.downfacevalue  ,
                    useruuid: (this.filters.useruuid == "0" || this.filters.useruuid.length == 0) ? "": this.filters.useruuid,
                    operatoruid: this.filters.operatoruid == "0" ? "": this.filters.operatoruid,
                    downprouuid: '',
                    fastchargetype: '',
                    validity: this.filters.validity == "0" ? "": this.filters.validity,
                    cityName: this.filters.cityName,
                    auto: this.filters.auto,
                    status: this.filters.status == "0" ? "" :this.filters.status,
                    discount:this.filters.discount
                };
                this.listLoading = true;
                downProductFind(para).then((datas) => {
                    let {message, code, data} = datas;
                    if (code !== "0") {
                        this.$message({
                            message: message,
                            type: 'error'
                        });
                    } else if(data && data.result) {
                        this.products = data.result;
                        this.total = data.totalCount;
                    }
                    this.listLoading = false;
                });
            },
            exportDownProduct(){
                let para = {
                    operatoruid: this.filters.operatoruid == "0" ? "" : this.filters.operatoruid ,
                    provinceuuid: this.filters.provinceuuid == "0" ? "" : this.filters.provinceuuid ,
                    busuuid: this.filters.busuuid == "0" ? "" : this.filters.busuuid,
//                  useruuid:JSON.parse(sessionStorage.getItem("user")).useruuid ,
                    downfacevalue:  (this.filters.downfacevalue == "0" || this.filters.downfacevalue.length == 0)? "" : this.filters.downfacevalue,
                    useruuid: this.filters.useruuid == "0" ? "": this.filters.useruuid,
                    downprouuid: '',
                    fastchargetype: ''
                };
                this.listLoading = true;
                exportDownProduct(para).then((datas) => {
                    let {message, code, data} = datas;
                    if (code !== "0") {
                        this.$message({
                            message: message,
                            type: 'error'
                        });
                    } else {
                        window.open(data.path);
                    }
                    this.listLoading = false;
                });
            },
            //显示编辑界面
            handleEdit: function (index, row) {
                //处理地市
                this.findAllCity(row.provincialInformation.provincename);
                this.editFormVisible = true;
                this.downfindlist();
                let para = {
                    downprouuid: row.downprouuid
                };
                findOpeProBusShop(para).then(datas => {
                    let {message, code, data} = datas;
                    if (code !== "0") {
                        this.$message({
                            message: message,
                            type: 'error'
                        });
                    } else if(data) {
                        this.operator = data.operator;
                        this.info = data.info;
                        this.bus = data.bus;
                        findOneDownProduct(para).then(datas => {
                            let {message, code, data} = datas;
                            if (code !== "0") {
                                this.$message({
                                    message: message,
                                    type: 'error'
                                });
                            } else {
                                this.editForm.operatoruid = data.operators.operatoruid;
                                this.editForm.provinceuuid = data.provincialInformation.provinceuuid;
                                this.editForm.busuuid = data.businessType.busuuid;
                                this.editForm.useruuid = data.user.useruuid;
                                this.editForm.fastchargetype = data.fastchargetype + "";
                                this.editForm.productCode = data.productCode;
                                this.editForm.downfacevalue = data.downfacevalue;
                                this.editForm.discount = data.discount;
                                this.editForm.remark = data.remark;
                                this.editForm.productName = data.productName;
                                this.editForm.downprouuid = data.downprouuid;
                                this.editForm.price = data.price;
                                this.editForm.discountAmount = data.discountAmount;
                                this.editForm.validity = data.validity;
                                this.editForm.cityName = data.cityName;
                            }
                        });
                    }
                });
            }, findAllBus: function () {
                let para = {useruuid: ''};
                findAllBus(para).then(datas => {
                    let {message, code, data} = datas;
                    if (code !== "0") {
                        this.$message({
                            message: message,
                            type: 'error'
                        });
                    } else {
                        this.bus = data;
                    }
                });
            },
            //显示新增界面
            handleAdd: function () {
                this.addFormVisible = true;
                this.setProducts = [];
                this.searchInfo();
                this.findAllDownShopInfo();
            },searchInfo(){
                let para = {
                    test: ''
                };
                this.downfindlist();
                findOpeProBusShop(para).then(datas => {
                    let {message, code, data} = datas;
                    if (code !== "0") {
                        this.$message({
                            message: message,
                            type: 'error'
                        });
                    } else if(data) {
                        this.operator = data.operator;
                        this.info = data.info;
                        this.bus = data.bus;
                    }
                });
            },
            changeOperator:function(value){
                this.addForm.channe = [];
                let para = {
                    operatoruid:value
                };
                findByChannel(para).then(datas =>{
                    let {message, code, data} = datas;
                    if (code !== "0") {
                        this.$message({
                            message: message,
                            type: 'error'
                        });
                    } else {
                        this.channels = data;
                    }
                })
            },
            handleCheckedChange(value){
                this.gernProduct();
            },
            //编辑
            editSubmit: function () {
                this.$refs.editForm.validate((valid) => {
                    if (valid) {
                        this.$confirm('确认提交吗？', '提示', {}).then(() => {
                            this.editLoading = true;
                            let para = Object.assign({}, this.editForm);
                            updateDownProduct(para).then((datas) => {
                                this.editLoading = false;
                                let {message, code, data} = datas;
                                if (code !== "0") {
                                    this.$message({
                                        message: message,
                                        type: 'error'
                                    });
                                }
                                this.$refs['editForm'].resetFields();
                                this.editFormVisible = false;
                                this.downProductFind();
                            });
                        });
                    }
                });
            },
            //新增
            addUpProduct: function () {
                this.$refs.addForm.validate((valid) => {
                    if (valid) {
                        this.$confirm('确认提交吗？', '提示', {}).then(() => {
                            this.addLoading = true;
                            //NProgress.start();
                            let para = Object.assign({}, this.addForm);
                            para.products = this.setProducts;
                            addDownBatchProduct(para).then((datas) => {
                                this.addLoading = false;
                                let {message, code, data} = datas;
                                if (code !== "0") {
                                    this.$message({
                                        message: message,
                                        type: 'error'
                                    });
                                }
                                this.downProductFind();
                            });
                        });
                    }
                });
            },
            discountChangeAdd:function () {
                this.gernProduct();
            },
            gernProduct(){
                var temps = this.setProducts;
                this.setProducts = [];
                for(var cha in this.addForm.channe){
                    for(var ch in this.channels){
                        if(this.channels[ch].basePrice +""== this.addForm.channe[cha]){
                            if(this.addForm.packagetype == 1){
                                var obj = new Object();
                                obj.price = this.channels[ch].basePrice;
                                obj.downfacevalue = this.channels[ch].flow;
                                obj.discount = (this.channels[ch].basePrice * this.addForm.unitPrice / this.channels[ch].basePrice).toFixed(5);
                                obj.discountAmount = (this.channels[ch].basePrice * this.addForm.unitPrice ).toFixed(5);
                                obj.productCode = obj.downfacevalue;
                                if(this.addForm.provinceuuid){
                                    const result = this.info.find(item => { return item.provinceuuid == this.addForm.provinceuuid });
                                    if(result){
                                        obj.productName = result.provincename + obj.downfacevalue+"话费";
                                    }else{
                                        obj.productName = obj.downfacevalue+"话费";
                                    }
                                }else{
                                    obj.productName = obj.downfacevalue+"话费";
                                }
                                this.setProducts.push(obj);
                            }else if(this.addForm.packagetype == 0){
                                var obj = new Object();
                                obj.price = this.channels[ch].basePrice;
                                obj.downfacevalue = this.channels[ch].flow;
                                obj.discount = this.addForm.unitPrice;
                                obj.discountAmount = (this.channels[ch].basePrice * this.addForm.unitPrice ).toFixed(5);
                                obj.productCode = obj.downfacevalue;
                                if(this.addForm.provinceuuid){
                                    const result = this.info.find(item => { return item.provinceuuid == this.addForm.provinceuuid });
                                    if(result){
                                        obj.productName = result.provincename + obj.downfacevalue+"话费";
                                    }else{
                                        obj.productName = obj.downfacevalue+"话费";
                                    }
                                }else{
                                    obj.productName = obj.downfacevalue+"话费";
                                }
                                this.setProducts.push(obj);
                            }
                        }
                    }
                }
            },
            discountChangeEdit:function () {
                this.editForm.discountAmount = this.editForm.discount * this.editForm.price;
            },
            userChange: function (user) {
                this.addForm.useruuid = user;
            },
            handleCurrentChange: function (val) {
                this.start = val - 1;
                this.downProductFind();
            },
            handleSizeChange: function (val) {
                this.pageSize = val;
                this.downProductFind();
            },
            matchStrategy: function (index, row) {
                this.enumType = 1;
                this.matchForm.useruuid = "";
                this.matchForm.downuuid = "";
                this.matchProduct = row;
                this.matchVisible = true;

                const oper =  this.operator.find(item => {return row.operators.operatorname == item.operatorname});
                if(oper){
                    this.matchForm.operatoruid = oper.operatoruid;
                }
                const infoCity =  this.info.find(item => {return row.provincialInformation.provincename == item.provincename});
                if(infoCity){
                    this.matchForm.provinceuuid = infoCity.provinceuuid;
                }
                const busInfo =  this.bus.find(item => {return row.businessType.busname == item.busname});
                if(busInfo){
                    this.matchForm.busuuid = busInfo.busuuid;
                }
                const downUser = this.users.find(item => {return item.username == row.user.username});
                if(downUser){
                    this.matchForm.downuuid = downUser.user.useruuid;
                }

                this.matchForm.upfacevalue = [row.downfacevalue];
                this.downProductMatchFind(row);
            },
            findOpeProBusShop(){
                let para = {sdffds: ''};
                findOpeProBusShop(para).then(datas => {
                    let {message, code, data} = datas;
                    if (code !== "0") {
                        this.$message({
                            message: message,
                            type: 'error'
                        });
                    } else {
                        this.operator = data.operator;
                        this.info = data.info;
                        this.bus = data.bus;
                        for(let obj in this.info){
                            this.info[obj].label= this.getPingYing(this.info[obj].provincename);
                        }
                    }
                });
            },getPingYing(content){
                const result = pinyin(content, {
                    style: pinyin.STYLE_FIRST_LETTER, // 设置拼音风格
//                    heteronym: true
                });
                var temp = "";
                for(let res in result){
                    temp += result[res];
                }
                return temp;
            },
            saveMatch: function () {
                if(this.matchForm.operatoruid == ""){
                    this.$message({
                        message: "请先选择运营商",
                        type: 'error'
                    });
                    return;
                }
                if(this.matchForm.provinceuuid == ""){
                    this.$message({
                        message: "请先选择省份",
                        type: 'error'
                    });
                    return;
                }
                if(this.matchForm.busuuid == ""){
                    this.$message({
                        message: "请先选择业务类型",
                        type: 'error'
                    });
                    return;
                }

                if(this.matchForm.downuuid == ""){
                    this.$message({
                        message: "请先选择分销商",
                        type: 'error'
                    });
                    return;
                }
                //如果选择了上游产品则不需要选择供货商
                if(this.matchForm.useruuid == "" && this.selsBatch.length == 0 ){
                    this.$message({
                        message: "请先选择供货商",
                        type: 'error'
                    });
                    return;
                }

                if(!this.matchProduct.downprouuid && this.sels && this.sels.length == 0){
                    this.$message({
                        message: "请先选择产品",
                        type: 'error'
                    });
                    return;
                }
                //计算批量选择
                const pros = [];
                this.sels.forEach( item => {
                    pros.push(item.downprouuid);
                });
                let para = {
                    downprouuid: this.enumType ==  1 ? [this.matchProduct.downprouuid ] : pros,
                    downuuid: this.matchForm.downuuid,
                    upuuid: this.matchForm.useruuid,
                    remark:'add match',
                    upprouuids:this.selsBatch,
                    provinceuuid: this.matchForm.provinceuuid,
                    operatoruid: this.matchForm.operatoruid,
                    cityName: this.matchForm.cityName,
                    busuuid: this.matchForm.busuuid
                };
                addProductStrategy(para).then(datas => {
                    let {message, code, data} = datas;
                    if (code !== "0") {
                        this.$message({
                            message: message,
                            type: 'error'
                        });
                    } else {
                        this.$message({
                            message: message,
                            type: 'info'
                        });
                        this.downProductFind();
                        this.matchVisible = false;
                    }
                });
            },
            // saveMatchBatch(){
            //     if(this.matchBatchForm.operatoruid == ""){
            //         this.$message({
            //             message: "请先选择运营商",
            //             type: 'error'
            //         });
            //         return;
            //     }
            //     if(this.matchBatchForm.provinceuuid == ""){
            //         this.$message({
            //             message: "请先选择省份",
            //             type: 'error'
            //         });
            //         return;
            //     }
            //
            //     if(this.matchBatchForm.useruuid == ""){
            //         this.$message({
            //             message: "请先选择供货商",
            //             type: 'error'
            //         });
            //         return;
            //     }
            //
            //     let para = {
            //         downuuid: this.matchProduct.useruuid,
            //         upuuid: this.matchBatchForm.useruuid,
            //         remark:'add match'
            //     };
            //     addProductStrategy(para).then(datas => {
            //         let {message, code, data} = datas;
            //         if (code !== "0") {
            //             this.$message({
            //                 message: message,
            //                 type: 'error'
            //             });
            //         } else {
            //             this.$message({
            //                 message: message,
            //                 type: 'info'
            //             });
            //             this.downProductFind();
            //             this.matchVisible = false;
            //         }
            //     });
            // },
            toggleSelection(rows) {
                if (rows) {
                    rows.forEach(row => {
                        this.$refs.multipleTable.toggleRowSelection(row,true);
                    });
                } else {
                    this.$refs.multipleTable.clearSelection();
                }
            },
            handleBatchEditAll(){
                if(this.filters.operatoruid == ""){
                    this.$message({
                        message: "请先选择运营商",
                        type: 'error'
                    });
                    return;
                }
                if(this.filters.provinceuuid == ""){
                    this.$message({
                        message: "请先选择省份",
                        type: 'error'
                    });
                    return;
                }
                if(this.filters.busuuid == "" ){
                    this.$message({
                        message: "请先选择业务类型",
                        type: 'error'
                    });
                    return;
                }

                if(!this.filters.discount){
                    this.$message({
                        message: "请先填入批量修改折扣",
                        type: 'error'
                    });
                    return;
                }
                this.batchForm.operatoruid = this.filters.operatoruid;
                this.batchForm.provinceuuid = this.filters.provinceuuid;
                this.batchForm.busuuid = this.filters.busuuid;
                this.batchForm.useruuid = this.filters.useruuid;
                this.changeOperator(this.filters.operatoruid);
                //查询地市
                const result = this.info.find(item => item.provinceuuid == this.batchForm.provinceuuid);
                if(result){
                    this.findAllCity(result.provincename)
                    this.findBatchEditDownProduct(this.filters.cityName);
                }else{
                    this.findBatchEditDownProduct('');
                }
                this.batchFormVisibleAll = true;
            },
            handleBatchEdit(){
                if(this.filters.operatoruid == ""){
                    this.$message({
                        message: "请先选择运营商",
                        type: 'error'
                    });
                    return;
                }
                if(this.filters.provinceuuid == ""){
                    this.$message({
                        message: "请先选择省份",
                        type: 'error'
                    });
                    return;
                }
                if(this.filters.busuuid == "" && this.filters.busuuid == "4028b8815fcad58a015fcfc0d330001c"){
                    this.$message({
                        message: "请先选择业务类型,并且必须不能为手机",
                        type: 'error'
                    });
                    return;
                }

                if(this.filters.useruuid == ""){
                    this.$message({
                        message: "请先选择分销商",
                        type: 'error'
                    });
                    return;
                }
                this.batchForm.operatoruid = this.filters.operatoruid;
                this.batchForm.provinceuuid = this.filters.provinceuuid;
                this.batchForm.busuuid = this.filters.busuuid;
                this.batchForm.useruuid = this.filters.useruuid;
                this.changeOperator(this.filters.operatoruid);
                //查询地市
                const result = this.info.find(item => item.provinceuuid == this.batchForm.provinceuuid);
                if(result){
                    this.findAllCity(result.provincename)
                    this.findBatchEditDownProduct(this.filters.cityName);
                }else{
                    this.findBatchEditDownProduct('');
                }
                this.batchFormVisible = true;
            },
            handleBatchUpProduct(){
                this.enumType = 2;
                this.matchForm.useruuid = "";
                this.matchForm.downprouuid = "";
                if(this.filters.operatoruid == ""){
                    this.$message({
                        message: "请先选择运营商",
                        type: 'error'
                    });
                    return;
                }
                if(this.filters.provinceuuid == ""){
                    this.$message({
                        message: "请先选择省份",
                        type: 'error'
                    });
                    return;
                }
                if(this.filters.busuuid == "" ){
                    this.$message({
                        message: "请先选择业务类型",
                        type: 'error'
                    });
                    return;
                }

                if(this.filters.useruuid == ""){
                    this.$message({
                        message: "请先选择分销商",
                        type: 'error'
                    });
                    return;
                }
                if(!this.sels || this.sels.length == 0){
                    this.$message({
                        message: "请先选择列表产品",
                        type: 'error'
                    });
                    return;
                }
                this.matchVisible = true;
                if(this.filters.downfacevalue){
                    this.matchForm.upfacevalue = this.filters.downfacevalue
                }

                //按条件查询当前渠道产品和符合手动匹配的上游渠道产品
                this.matchForm.operatoruid = this.filters.operatoruid;
                this.matchForm.provinceuuid = this.filters.provinceuuid;
                this.matchForm.busuuid = this.filters.busuuid;
                //批量操作使用
                this.matchForm.downuuid = this.filters.useruuid;

                //查询地市
                const result = this.info.find(item => item.provinceuuid == this.matchBatchForm.provinceuuid);
                if(result){
                    this.findAllCity(result.provincename)
                    this.findBatchEditDownProductBatch(this.matchBatchForm.cityName,this.matchForm.upfacevalue);
                }else{
                    this.findBatchEditDownProductBatch('',this.matchForm.upfacevalue);
                }
            },
            handleBatchCheckedChange(){
                this.batchProduct();
            },
            discountBatchChangeAdd(){
                this.batchProduct();
            },
            discountBatchChangeAddAll(){
                this.batchProductAll();
            },
            batchProductAll(){
                this.setBatchProductsAll.forEach(obj =>{
                    // {"auto":1,"cityName":"","createtime":"2021-07-14 22:18:15","discount":2,"discountAmount":20,"downfacevalue":"10","downfailnum":0,
                    //     "downprouuid":"2c922ab97aa55e64017aa561e6800012","downtimeinterva":1,"fastchargetype":1,"modifytime":null,"price":10,"productCode":"10",
                    //     "productName":"全国10话费","remark":"","status":1,"validity":""}
                    obj.discount = (obj.price * this.batchForm.unitPrice / obj.price).toFixed(5);
                    obj.discountAmount = (obj.price * this.batchForm.unitPrice ).toFixed(5);
                });
            },
            batchProduct(){
                this.setBatchProducts.forEach(item =>{
                    item.discount = (item.price * this.batchForm.unitPrice / item.price).toFixed(5);
                    item.discountAmount = (item.price * this.batchForm.unitPrice ).toFixed(5);
                })
            },
            findBatchEditDownProductBatch(cityName,upfacevalue){
                let para = {
                    start: this.startMatch,
                    pageSize: this.pageSizeMatch,
                    downprouuids: this.sels ? this.sels : [],
                    busuuid: this.matchForm.busuuid == "0" ? "" : this.matchForm.busuuid,
                    operatoruid: this.matchForm.operatoruid == "0" ? "" : this.matchForm.operatoruid,
                    provinceuuid: this.matchForm.provinceuuid == "0" ? "" : this.matchForm.provinceuuid,
                    useruuids: this.matchBatchForm.useruuid == "0" ? "" : this.matchBatchForm.useruuid,
                    upfacevalue:upfacevalue ? upfacevalue : '',

                    cityName:cityName
                };
                this.listLoading = false;
                downProductMatchFind(para).then((datas) => {
                    let {message, code, data} = datas;
                    if (code !== "0") {
                        this.$message({
                            message: message,
                            type: 'error'
                        });
                    } else if(data) {
                        this.upproducts = data.result;
                        this.totalMatch = data.totalCount;
                        if(!this.users){
                            this.$message({
                                message: '请刷新后在试',
                                type: 'error'
                            });
                        }
                        setTimeout(()=>{
                            for(var j = 0 ; j < this.sels.length; j++){
                                for(var i  = 0 ; i < this.upproducts.length; i++) {
                                    if (this.upproducts[i].remark == this.sels[j].downprouuid) {
                                        this.$refs.multipleTable.toggleRowSelection(this.upproducts[i], true);
                                    }
                                }
                            }
                        },1000);
                    }
                    this.listLoading = false;
                });
            },
            findBatchEditDownProduct(cityName){
                this.setBatchProducts = [];
                this.setBatchPhoneProducts = [];
                this.batchForm.channe = [];
                this.setBatchProductsAll = [];
                let  para = {
                    operatoruid : this.filters.operatoruid,
                    provinceuuid : this.filters.provinceuuid,
                    busuuid : this.filters.busuuid,
                    useruuid : this.filters.useruuid,
                    cityName: cityName,
                    discount:this.filters.discount,
                    downfacevalue :  (this.filters.downfacevalue == "0" || this.filters.downfacevalue.length == 0)? "" : this.filters.downfacevalue
                }
                findBatchEditDownProduct(para).then(results =>{
                    let {message, code, data} = results;
                    if (code !== "0") {
                        this.$message({
                            message: message,
                            type: 'error'
                        });
                    }
                    if(!data || data.length == 0){
                        this.$message({
                            message: "没有找到产品,请重新选择",
                            type: 'error'
                        });
                    }else{

                        for(var pro in data){
                            this.batchForm.channe.push(parseInt(data[pro].downfacevalue));
                            // if(data[pro].downfacevalue >= 1024 ){
                            //     this.batchForm.channe.push(data[pro].downfacevalue / 1024 );
                            // }else{
                            //     this.batchForm.channe.push(data[pro].downfacevalue);
                            // }
                            var obj = new Object();
                            obj.price = data[pro].price;
                            obj.downfacevalue = data[pro].downfacevalue;
                            obj.discount = data[pro].discount;
                            obj.discountAmount = data[pro].discountAmount;
                            obj.downprouuid = data[pro].downprouuid;
                            obj.productName = data[pro].productName;
                            obj.productCode = data[pro].productCode;
                            this.batchForm.unitPrice = data[pro].discount+'';
                            if(cityName){
                                this.batchForm.cityName = data[pro].cityName;
                            }
                            this.setBatchProducts.push(obj);
                            this.setBatchPhoneProducts.push(obj);
                            this.setBatchProductsAll.push(obj);
                        }
                    }
                });
            },
            batchEditDownProductAll(){
                this.$refs.batchForm.validate((valid) => {
                    if (valid) {
                        this.$confirm('确认提交吗？', '提示', {}).then(() => {
                            this.batchLoading = true;
                            //NProgress.start();
                            let para = Object.assign({}, this.batchForm);
                            para.products = this.setBatchProductsAll;
                            batchEditDownProductAll(para).then((datas) => {
                                this.batchLoading = false;
                                let {message, code, data} = datas;
                                if (code !== "0") {
                                    this.$message({
                                        message: message,
                                        type: 'error'
                                    });
                                }else{
                                    this.$message({
                                        message: message,
                                        type: 'info'
                                    });
                                }
                                this.downProductFind();
                            });
                        });
                    }
                });
            },
            batchEditDownProduct(){
                this.$refs.batchForm.validate((valid) => {
                    if (valid) {
                        this.$confirm('确认提交吗？', '提示', {}).then(() => {
                            this.batchLoading = true;
                            //NProgress.start();
                            let para = Object.assign({}, this.batchForm);
                            para.products = this.setBatchProducts;
                            batchEditDownProduct(para).then((datas) => {
                                this.batchLoading = false;
                                let {message, code, data} = datas;
                                if (code !== "0") {
                                    this.$message({
                                        message: message,
                                        type: 'error'
                                    });
                                }else{
                                    this.$message({
                                        message: message,
                                        type: 'info'
                                    });
                                }
                                this.downProductFind();
                            });
                        });
                    }
                });
            },
            batchCellclick:function(row, column, cell, event){
                if(column.label == "产品名称"){
                    var div = document.createElement("input");
                    div.value = cell.childNodes[0].innerHTML ;
                    div.style="height:32px;width:98px;"
                    cell.replaceChild(div,cell.childNodes[0]);
                    div.focus();
                }
                if(column.label == "虚拟编码"){
                    var div = document.createElement("input");
                    div.value = cell.childNodes[0].innerHTML ;
                    div.style="height:32px;width:98px;"
                    cell.replaceChild(div,cell.childNodes[0]);
                    div.focus();
                }
            },
            batchCellmouseleave:function(row, column, cell, event){
                if(column.label == "产品名称" && cell.childNodes[0].tagName.toLocaleLowerCase()=='input'){
                    var div = document.createElement("div");
                    div.setAttribute("class","cell");
                    div.innerHTML = cell.childNodes[0].value;
                    for(var pro in this.setProducts) {
                        if (this.setProducts[pro].price == row.price && row.downfacevalue == this.setProducts[pro].downfacevalue) {
                            this.setProducts[pro].productName = cell.childNodes[0].value;
                        }
                    }
                    cell.replaceChild(div,cell.childNodes[0]);
                }
                if(column.label == "虚拟编码" && cell.childNodes[0].tagName.toLocaleLowerCase()=='input'){
                    var div = document.createElement("div");
                    div.setAttribute("class","cell");
                    div.innerHTML = cell.childNodes[0].value;
                    for(var pro in this.setProducts) {
                        if (this.setProducts[pro].price == row.price && row.downfacevalue == this.setProducts[pro].downfacevalue) {
                            this.setProducts[pro].productCode = cell.childNodes[0].value;
                        }
                    }
                    cell.replaceChild(div,cell.childNodes[0]);
                }
            },
            cellclick:function(row, column, cell, event){
                if(column.label == "产品名称"){
                    var div = document.createElement("input");
                    div.value = cell.childNodes[0].innerHTML ;
                    div.style="height:32px;width:98px;"
                    cell.replaceChild(div,cell.childNodes[0]);
                    div.focus();
                }
                if(column.label == "虚拟编码"){
                    var div = document.createElement("input");
                    div.value = cell.childNodes[0].innerHTML ;
                    div.style="height:32px;width:98px;"
                    cell.replaceChild(div,cell.childNodes[0]);
                    div.focus();
                }
            },
            cellmouseleave:function(row, column, cell, event){
                if(column.label == "产品名称" && cell.childNodes[0].tagName.toLocaleLowerCase()=='input'){
//                <div class="cell">10</div>
                    var div = document.createElement("div");
                    div.setAttribute("class","cell");
                    div.innerHTML = cell.childNodes[0].value;
                    for(var pro in this.setBatchProducts){
                        if(this.setBatchProducts[pro].price == row.price && row.downfacevalue == this.setBatchProducts[pro].downfacevalue){
                            this.setBatchProducts[pro].productName = cell.childNodes[0].value;
                        }
                    }
                    cell.replaceChild(div,cell.childNodes[0]);
                }
                if(column.label == "虚拟编码" && cell.childNodes[0].tagName.toLocaleLowerCase()=='input'){
                    var div = document.createElement("div");
                    div.setAttribute("class","cell");
                    div.innerHTML = cell.childNodes[0].value;
                    for(var pro in this.setBatchProducts){
                        if(this.setBatchProducts[pro].price == row.price && row.downfacevalue == this.setBatchProducts[pro].downfacevalue){
                            this.setBatchProducts[pro].productCode = cell.childNodes[0].value;
                        }
                    }
                    cell.replaceChild(div,cell.childNodes[0]);
                }
            },
            handleBatchAuto:function () {
                if(this.sels != null  && this.sels.length > 0){
                    var temp = false;
                    for(var i = 0 ; i < this.sels.length;i++){
                        if(this.sels[i].auto == 0){
                            this.$message({
                                message: "不能处理匹配模式为自动的产品:"+this.sels[i].productName,
                                type: 'error'
                            });
                            temp = true;
                        }
                    }
                    if(!temp){
                        this.$confirm('确认提交吗？', '提示', {}).then(() => {
                            let para = {products:this.sels,auto:0};
                            autoProduct(para).then(datas =>{
                                let {message, code, data} = datas;
                                if (code !== "0") {
                                    this.$message({
                                        message: message,
                                        type: 'error'
                                    });
                                }else{
                                    this.$message({
                                        message: "操作成功",
                                        type: 'info'
                                    });
                                }
                                this.downProductFind();
                            });
                        });
                    }
                }else{
                    this.$message({
                        message: "请选择产品,并且只能处理产品为手动匹配的产品",
                        type: 'error'
                    });
                }
            },
            handleBatchOpen:function(){
                if(this.sels != null  && this.sels.length > 0){
                    this.$confirm('确认开启产品吗？', '提示', {}).then(() => {
                        let para = {products:this.sels,status:1};
                        handleBatchClose(para).then(datas =>{
                            let {message, code, data} = datas;
                            if (code !== "0") {
                                this.$message({
                                    message: message,
                                    type: 'error'
                                });
                            }else{
                                this.$message({
                                    message: "操作成功",
                                    type: 'info'
                                });
                            }
                            this.downProductFind();
                        });
                    });
                }else{
                    this.$message({
                        message: "请选择产品",
                        type: 'error'
                    });
                }
            },
            handleBatchClose:function(){
                if(this.sels != null  && this.sels.length > 0){
                    this.$confirm('确认关闭产品吗？', '提示', {}).then(() => {
                        let para = {products:this.sels,status:2};
                        handleBatchClose(para).then(datas =>{
                            let {message, code, data} = datas;
                            if (code !== "0") {
                                this.$message({
                                    message: message,
                                    type: 'error'
                                });
                            }else{
                                this.$message({
                                    message: "操作成功",
                                    type: 'info'
                                });
                            }
                            this.downProductFind();
                        });
                    });
                }else{
                    this.$message({
                        message: "请选择产品",
                        type: 'error'
                    });
                }
            },
            selsChange: function (sels) {
                this.sels = sels;
            },
            findAllCity:function (province,arrays) {
                let para = {
                    province : province
                };
                findAllCity(para).then((datas) => {
                    this.addLoading = false;
                    let { message, code, data } = datas;
                    if (code !== "0") {
                        this.$message({
                            message: message,
                            type: 'error'
                        });
                    }
                    this.infoFilters = [];
                    this.citys = [];
                    data.forEach((item,index) =>{
                        this.citys.push({id:index,cityName:item});
                        this.infoFilters.push({id:index,cityName:item});
                    })
                });
            },
            selectCity(provinceuuid){
                // this.addForm.cityName = "";
                // this.editForm.cityName = "";
                const result = this.info.find(item => item.provinceuuid == provinceuuid);
                if(result){
                    this.findAllCity(result.provincename)
                }
                if(provinceuuid ){
                    if(this.setBatchProducts){
                        const result = this.info.find(item => { return item.provinceuuid ==  provinceuuid});
                        if(result){
                            this.setBatchProducts.forEach( item =>{
                                const face = item.productName.replace(/[^0-9]/ig,"");
                                item.productName = result.provincename + face + "话费";
                            });
                        }
                    }
                    if(this.setProducts){
                        const result = this.info.find(item => { return item.provinceuuid ==  provinceuuid});
                        if(result){
                            this.setProducts.forEach( item =>{
                                const face = item.productName.replace(/[^0-9]/ig,"");
                                item.productName = result.provincename + face + "话费";
                            });
                        }
                    }
                }
            },
            //查询产品
            changeBatchUser(){
                this.downProductMatchBatch();
            },
            findAllChannel(){
                let para = {
                    province : ""
                };
                findAllChannel(para).then((datas) => {
                    this.addLoading = false;
                    let { message, code, data } = datas;
                    if (code !== "0") {
                        this.$message({
                            message: message,
                            type: 'error'
                        });
                    }else if(data){
                        data.forEach(item =>{
                            this.downfacevalues.push({id:item,value:item});
                        });
                    }
                });
            },
            //定时调价
            timerPrice(){
                if(this.filters.operatoruid == ""){
                    this.$message({
                        message: "请先选择运营商",
                        type: 'error'
                    });
                    return;
                }
                if(this.filters.provinceuuid == ""){
                    this.$message({
                        message: "请先选择省份",
                        type: 'error'
                    });
                    return;
                }

                if(this.filters.busuuid == ""){
                    this.$message({
                        message: "请先选择业务类型",
                        type: 'error'
                    });
                    return;
                }

                if(this.filters.useruuid == ""){
                    this.$message({
                        message: "请先选择分销商",
                        type: 'error'
                    });
                    return;
                }
                this.matchBatchForm.operatoruid = this.filters.operatoruid;
                this.matchBatchForm.provinceuuid = this.filters.provinceuuid;
                this.matchBatchForm.busuuid = this.filters.busuuid;
                this.matchBatchForm.useruuid = this.filters.useruuid;
                this.matchBatchForm.downfacevalue = this.filters.downfacevalue;
                this.matchFormBatchLoading = true;
                this.downProductMatchBatch();
            },
            selectTableTimer(){

            },
            handleSelectionChangeBatchTimer(sels){
                this.selsBatchTimer = sels;
                if(sels && sels.length > 0 && !this.matchBatchForm.beforediscount ){
                    this.matchBatchForm.beforediscount = sels[0].discount;
                }
                this.$message({
                    message: "当前已经选择"+sels.length+"个产品",
                    type: 'info'
                });
            },
            handleCurrentChangeMatchBatchTimer: function (val) {
                this.startMatchBatchTimer = val - 1;
                this.downProductMatchBatch();
            },
            handleSizeChangeMatchBatchTimer: function (val) {
                this.pageSizeMatchBatchTimer = val;
                this.downProductMatchBatch();
            },
            saveBatchPrice(){
                if(this.matchBatchForm.operatoruid == ""){
                    this.$message({
                        message: "请先选择运营商",
                        type: 'error'
                    });
                    return;
                }
                if(this.matchBatchForm.provinceuuid == ""){
                    this.$message({
                        message: "请先选择省份",
                        type: 'error'
                    });
                    return;
                }
                if(this.matchBatchForm.busuuid == ""){
                    this.$message({
                        message: "请先选择业务类型",
                        type: 'error'
                    });
                    return;
                }
                if(this.matchBatchForm.useruuid == ""){
                    this.$message({
                        message: "请先选择分销商",
                        type: 'error'
                    });
                    return;
                }
                if(this.selsBatchTimer.length == 0){
                    this.$message({
                        message: "请选择产品",
                        type: 'error'
                    });
                    return;
                }
                if(!this.matchBatchForm.executeTime){
                    this.$message({
                        message: "执行时间必填,请选择向前时间点执行",
                        type: 'error'
                    });
                    return;
                }

                if(this.checkProductDiscount(this.selsBatchTimer)){
                    this.$confirm('产品折扣有差异，确定保存吗?', '提示', {
                        type: 'warning'
                    }).then(() => {
                        this.saveTimer(this.matchBatchForm,this.selsBatchTimer);
                    }).catch(() => {

                    });
                }else{
                    this.saveTimer(this.matchBatchForm,this.selsBatchTimer);
                }
            },
            saveTimer(form,batchTimer){
                if(parseFloat(this.matchBatchForm.beforediscount) == parseFloat(this.matchBatchForm.afterdiscount)){
                    this.$message({
                        message: "调价前和调价后折扣相同,不需要调价,请核实",
                        type: 'error'
                    });
                    return;
                }
                //取运营商 业务类型 分销商 省份 中文名称
                form.busname = this.bus.find(item =>{ return item.busuuid == form.busuuid; }).busname;
                form.operator = this.operator.find(item =>{ return item.operatoruid == form.operatoruid; }).operatorname;
                form.province = this.info.find(item =>{ return item.provinceuuid == form.provinceuuid}).provincename;
                //计算分销商名称
                let name = "";
                form.useruuid.forEach(itemUser => {
                    name += this.users.find(item => {return item.user.useruuid == itemUser }).user.username+",";
                });
                form.downName = name.substring(0,name.lastIndexOf(","));

                form.executeTime = (form.executeTime == "" || form.executeTime == undefined) ? "" : moment(form.executeTime,"YYYY-MM-DD HH:mm:ss").format('YYYY-MM-DD HH:mm:ss')
                form.batchTimer = batchTimer;
                console.log(form);

                batchProductTimer(form).then(datas => {
                    let {message, code, data} = datas;
                    if (code !== "0") {
                        this.$message({
                            message: message,
                            type: 'error'
                        });
                    } else {
                        this.$message({
                            message: "保存成功,可进入调价列表查看",
                            type: 'info'
                        });
                        this.matchFormBatchLoading = false;
                    }
                });
            },
            checkProductDiscount(products){
                if(products && products.length > 0){
                    const pro = products[0];
                    if(!this.matchBatchForm.beforediscount){
                        this.matchBatchForm.beforediscount = pro.discount;
                    }
                    const result = products.find(item =>{
                        return item.discount != pro.discount;
                    })
                    if(result){
                        return true;
                    }
                    return false;
                }
            },
            batchTimerPriceInput(){
                if(this.upproductsBatch && this.upproductsBatch.length > 0){
                    this.upproductsBatch.forEach(obj =>{
                        obj.discount = (obj.price * this.matchBatchForm.afterdiscount / obj.price).toFixed(5);
                        obj.discountAmount = (obj.price * this.matchBatchForm.afterdiscount ).toFixed(5);
                    });
                }
            },
            deleteEnable(index,row){
                this.$confirm('确定删除产品吗?', '提示', {
                    type: 'warning'
                }).then(() => {

                    deleteDownProduct([row]).then(datas => {
                        let {message, code, data} = datas;
                        if (code !== "0") {
                            this.$message({
                                message: message,
                                type: 'error'
                            });
                        } else {
                            this.$message({
                                message: "删除成功",
                                type: 'info'
                            });
                        }
                        this.downProductFind();
                    });
                }).catch(() => {

                });
            },
            copyProduct(){
                if(this.filters.operatoruid == ""){
                    this.$message({
                        message: "请先选择运营商",
                        type: 'error'
                    });
                    return;
                }
                if(this.filters.provinceuuid == ""){
                    this.$message({
                        message: "请先选择省份",
                        type: 'error'
                    });
                    return;
                }

                if(this.filters.busuuid == ""){
                    this.$message({
                        message: "请先选择业务类型",
                        type: 'error'
                    });
                    return;
                }

                if(this.filters.useruuid == ""){
                    this.$message({
                        message: "请先选择分销商",
                        type: 'error'
                    });
                    return;
                }
                this.copyBatchForm.operatoruid = this.filters.operatoruid;
                this.copyBatchForm.provinceuuid = this.filters.provinceuuid;
                this.copyBatchForm.busuuid = this.filters.busuuid;
                this.copyBatchForm.useruuid = this.filters.useruuid;
                this.copyBatchForm.downfacevalue = this.filters.downfacevalue;
                this.copyFormBatchLoading = true;
                this.copyProductMatchBatch();
            },
            saveBatchCopy(){
                if(!this.copyBatchForm.touseruuid){
                    this.$message({
                        message: "请选择复制到分销商",
                        type: 'error'
                    });
                    return;
                }
                this.$confirm('确定创建复制产品吗?', '提示', {
                    type: 'warning'
                }).then(() => {
                    let para = Object.assign({}, this.copyBatchForm);
                    para.products = this.selsBatchCopy;
                    copyDownBatchProduct(para).then((datas) => {
                        let {message, code, data} = datas;
                        if (code !== "0") {
                            this.$message({
                                message: message,
                                type: 'error'
                            });
                            return;
                        }
                        this.copyFormBatchLoading = false;
                        this.downProductFind();
                    });
                }).catch(() => {
                });
            },
            copyProductMatchBatch(row){
                let para = {
                    start: this.startMatchBatchCopy,
                    pageSize: this.pageSizeMatchBatchCopy,
                    provinceuuid:  this.copyBatchForm.provinceuuid == "0" ? "" : this.copyBatchForm.provinceuuid,
                    busuuid: this.copyBatchForm.busuuid == "0" ? "" : this.copyBatchForm.busuuid,
                    downfacevalue: (this.copyBatchForm.downfacevalue == "0" || this.copyBatchForm.downfacevalue.length == 0)? "" : this.copyBatchForm.downfacevalue  ,
                    useruuid: (this.copyBatchForm.useruuid == "0" || this.copyBatchForm.useruuid.length == 0) ? "": this.copyBatchForm.useruuid,
                    operatoruid: this.copyBatchForm.operatoruid == "0" ? "": this.copyBatchForm.operatoruid,
                    downprouuid: '',
                    fastchargetype: '',
                    validity: "",
                    cityName: this.copyBatchForm.cityName,
                    auto: "",
                    status: "",
                    discount:this.filters.discount
                };
                this.listLoading = false;
                downProductFind(para).then((datas) => {
                    let {message, code, data} = datas;
                    if (code !== "0") {
                        this.$message({
                            message: message,
                            type: 'error'
                        });
                    } else if(data && data.result) {
                        this.copyproductsBatch = data.result;
                        this.totalMatchBatchCopy = data.totalCount;
                    }
                    this.listLoading = false;
                });
            },
            handleSelectionChangeBatchCopy(sels){
                this.selsBatchCopy = sels;
                this.$message({
                    message: "当前已经选择"+sels.length+"个产品",
                    type: 'info'
                });
            },
            handleCurrentChangeMatchBatchCopy: function (val) {
                this.startMatchBatchCopy = val - 1;
                this.copyProductMatchBatch();
            },
            handleSizeChangeMatchBatchCopy: function (val) {
                this.pageSizeMatchBatchCopy = val;
                this.copyProductMatchBatch();
            },
        },
        async mounted() {
            await this.downProductFind();
        },
        async created() {
            await this.findAllDownShopInfo();
            await this.findAllUpShopInfo();
            await this.findOpeProBusShop();
            await this.findAllBus();
            await this.findAllChannel();
        }
    }

</script>

<style scoped>
    .el-dialog__body{
        padding: 10px 20px;
        color: #48576a;
        font-size: 14px;
    }
    .el-form-item{
        margin-bottom: 12px;
    }
</style>
